﻿/********************************************************************************
 * CoTime. All rights reserved.
 * Author: 刘冰
 * Email : ice6@live.cn
 * Description:
 *     Note的作用其实相当于Task的Group
 *     引入note概念是为了让ActivityInventory里的内容
 *     更像一个个便签纸    
*********************************************************************************/
using System;
using System.Collections.Generic;

namespace CoTime.Model
{
    public class Note
    {
        #region [ Fields / Properties ]

        public Int32 Id { get; set; }

        public String Name { get; set; }

        public List<Task> Tasks { get; set; }
        
        #endregion

        #region [ Constructor ]

        public Note()
        {
            this.Tasks = new List<Task>();
        }

        public Note(Int32 id):this()
        {
            this.Id = id;
        }

        public Note(Int32 id,String name)
            : this()
        {
            this.Id = id;
            this.Name = name;
        }

        #endregion

        #region [ Operations ]

        public void AddTask(Task task)
        {
            if (this.Tasks == null)
                this.Tasks = new List<Task>();
            this.Tasks.Add(task);
        }

        public void AddTask(List<Task> tasks)
        {
            if (this.Tasks == null)
                this.Tasks = new List<Task>();
            this.Tasks.AddRange(tasks);
        }

        #endregion
    }
}
